package com.zqwh.xtool.api.online;

import com.zqwh.yj.sdk.utils.httpRequest.beans.HttpResult2;
import com.zqwh.xtool.domain.LendInfo;
import com.zqwh.xtool.domain.LentData;
import com.zqwh.xtool.domain.StockVO;

import java.util.HashMap;
import java.util.List;

import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Header;
import retrofit2.http.POST;
import rx.Observable;

/**
 * Created by eason.yang on 2018/1/19.
 */
public interface LendOrderApi {
    /**
     * 预提交信息
     * @return
     */
    @POST("lendorder/owing/lend-item")
    @FormUrlEncoded
    Observable<HttpResult2<LentData>> getOwingStock(@Header("Authorization") String token,
                                                    @Field("devId") Long devId);

    /**
     * 预提交信息
     * @return
     */
    @POST("lendorder/pre-submit/info")
    @FormUrlEncoded
    Observable<HttpResult2<LendInfo>> getPreSubmitInfo(@Header("Authorization") String token,
                                                      @Field("devId") Long devId,
                                                      @Field("epcs") String epcs);

    /**
     * 提交借出单
     * @return
     */
    @POST("lendorder")
    @FormUrlEncoded
    Observable<HttpResult2<Object>> submitLendReturnOrder(@Header("Authorization") String token,
                                                    @Field("devId") Long devId,
                                                    @Field("epcs") String epcs);

    /**
     * 提交借出单
     * @return
     */
    @POST("lendorder/lend/submit")
    @FormUrlEncoded
    Observable<HttpResult2<Object>> submitLendOrder(@Header("Authorization") String token,
                                                    @Field("devId") Long devId,
                                                    @Field("userId") Long userId,
                                                     @Field("orderNo") String orderNo,
                                                     @Field("stockIds") String stockIds);

    /**
     * 提交归还单
     * @return
     */
    @POST("lendorder/return/submit")
    @FormUrlEncoded
    Observable<HttpResult2<Object>> submitReturnOrder(@Header("Authorization") String token,
                                                    @Field("devId") Long devId,
                                                    @Field("userId") Long userId,
                                                    @Field("stockIds") String stockIds);

    /**
     * 访问某设备某用户的借出项
     * @return
     */
    @POST("lendorder/lend/list")
    @FormUrlEncoded
    Observable<HttpResult2<HashMap<String, List<StockVO>>>> getLentOrderDetailList(@Header("Authorization") String token,
                                                                                   @Field("devId") Long devId,
                                                                                   @Field("userId") Long userId);
}
